function parseBoolean(value: unknown, fallback = false): boolean {
  if (typeof value === "boolean") return value;
  if (typeof value === "string") {
    const v = value.trim().toLowerCase();
    return ["1", "true", "yes", "on"].includes(v)
      ? true
      : ["0", "false", "no", "off"].includes(v)
      ? false
      : fallback;
  }
  return fallback;
}

export const ENV = {
  ENABLE_GPT5: parseBoolean(import.meta.env.VITE_ENABLE_GPT5, true),
  DEFAULT_MODEL: import.meta.env.VITE_DEFAULT_MODEL as string | undefined,
} as const;
